import java.io.*;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-11-03
 * Time: 21:21
 */
public class test_3 {
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();

    public static void main(String[] args) throws IOException {
        int k = in.nextInt();
        while (k > 0) {

            int n = in.nextInt();
            String[] strings = new String[n];
            for (int i = 0; i < n; i++) {
                strings[i] = in.next();
            }

            int mind = (n - 1) / 2;
            if (n % 2 != 0) {
                mind--;
            }
            int i = 0;
            boolean flag = false;
            while (i <= mind) {

                if (!have_comn(strings[i], strings[n - 1 - i])) {
                    flag = true;
                }

                if (flag) {
                    out.println("No");
                    break;
                }
                i++;
            }
            if (!flag) {
                out.println("Yes");
            }
            k--;
        }
        out.close();
    }

    private static boolean have_comn(String s1, String s2) {
        int[] hash = new int[26];
        for (char c : s1.toCharArray()) {
            hash[c - 'a']++;
        }
        for (char c : s2.toCharArray()) {
            if (hash[c - 'a'] > 0) {
                return true;
            }
        }

        return false;
    }
}

//快读模板
class Read {//自定义快读读入
    //字符串裁剪
    StringTokenizer st = new StringTokenizer("");

    //1.字节流System.in->字符流InputStreamReader
    //2.带内存缓冲区的字符流BufferedReader
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));


    String next() throws IOException {
        //为什么要while循环，因为可能读取的数据不止一行，有多行就需要多次取
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());//先拿一行的数据
        }
        return st.nextToken();//对这一行的数据进行裁剪，拿到第一个数据
    }

    String nextLine() throws IOException {
        return bf.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}